using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleNet
{
    /// <summary>
    /// A StyleMap maps between two different icon styles. 
    /// Typically a StyleMap element is used to provide separate 
    /// normal and highlighted styles for a placemark, so that the highlighted 
    /// version appears when the user mouses over the icon in Google Earth. 
/// </summary>
    public class KmlStyleMap : KmlStyleSelector
    {
        private string tagName = "StyleMap";

        #region Pair
        private KmlPair pair;

        /// <summary>
        /// Defines a key/value pair that maps a mode (normal or highlight) to the predefined styleUrl. 
        /// </summary>
        /// <value>The style mode.</value>
        public KmlPair Pair
        {
            get { return pair; }
            set { pair = value; }
        } 
        #endregion



        #region IKmlElement Members

        /// <summary>
        /// Name of the KML tag for this specific element.
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        public override string TagName
        {
            get { return tagName; }
        }

        #endregion

        #region IKmlGenerator Members

        /// <summary>
        /// Generates the KML for this element including its child elements.
        /// </summary>
        /// <param name="writer">The XML writer that will be used to generate the KML.</param>
        public override void GenerateKml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement(tagName);
            base.GenerateKml(writer);

            if (pair != null)
                pair.GenerateKml(writer);

            writer.WriteEndElement();
        }

        #endregion
    }
}
